+Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
+ menus to be transient for the toplevel they were torn off from.
+ (gtk_menu_get_toplevel): Auxiliary function to find the
+ toplevel of a menu. (#54775, Jon-Kare Hellan)
+
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
+ menus to be transient for the toplevel they were torn off from.
+ (gtk_menu_get_toplevel): Auxiliary function to find the
+ toplevel of a menu. (#54775, Jon-Kare Hellan)
+
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
+ menus to be transient for the toplevel they were torn off from.
+ (gtk_menu_get_toplevel): Auxiliary function to find the
+ toplevel of a menu. (#54775, Jon-Kare Hellan)
+
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
+ menus to be transient for the toplevel they were torn off from.
+ (gtk_menu_get_toplevel): Auxiliary function to find the
+ toplevel of a menu. (#54775, Jon-Kare Hellan)
+
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
+Wed Nov 5 22:49:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkmenu.c (gtk_menu_set_tearoff_state): Set torn off
+ menus to be transient for the toplevel they were torn off from.
+ (gtk_menu_get_toplevel): Auxiliary function to find the
+ toplevel of a menu. (#54775, Jon-Kare Hellan)
+
Wed Nov 5 21:07:58 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkpaned.c (gtk_paned_class_init): Add readonly properties
}
}
+static GtkWidget*
+gtk_menu_get_toplevel (GtkWidget *menu)
+{
+ GtkWidget *attach, *toplevel;
+
+ attach = gtk_menu_get_attach_widget (GTK_MENU (menu));
+
+ if (GTK_IS_MENU_ITEM (attach))
+ attach = attach->parent;
+
+ if (GTK_IS_MENU (attach))
+ return gtk_menu_get_toplevel (attach->parent);
+ else if (GTK_IS_WIDGET (attach))
+ {
+ toplevel = gtk_widget_get_toplevel (attach->parent);
+ if (GTK_WIDGET_TOPLEVEL (toplevel))
+ return toplevel;
+ }
+
+ return NULL;
+}
+
void
gtk_menu_set_tearoff_state (GtkMenu *menu,
gboolean torn_off)
if (!menu->tearoff_window)
{
+ GtkWidget *toplevel;
+
menu->tearoff_window = gtk_widget_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"screen", gtk_widget_get_screen (menu->toplevel),
"app_paintable", TRUE,
NULL);
+
gtk_window_set_type_hint (GTK_WINDOW (menu->tearoff_window),
GDK_WINDOW_TYPE_HINT_MENU);
gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->tearoff_window), 0);
gtk_menu_update_title (menu);
gtk_widget_realize (menu->tearoff_window);
+
+ toplevel = gtk_menu_get_toplevel (GTK_WIDGET (menu));
+ if (toplevel != NULL)
+ gtk_window_set_transient_for (GTK_WINDOW (menu->tearoff_window),
+ GTK_WINDOW (toplevel));
menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox);